
//错误信息提示
function showErrorTips(errorMes, errorTitle){
	toastr.error(errorMes, errorTitle)
	toastr.options = {
	  "closeButton":true,
	  "debug":false,
	  "positionClass":"toast-bottom-full-width",
	  "showDuration": "300",
	  "hideDuration": "1000",
	  "timeOut": "30000",
	  "extendedTimeOut": "1000",
	  "showEasing": "swing",
	  "hideEasing": "linear",
	  "showMethod": "fadeIn",
	  "hideMethod": "fadeOut"
	}
}

//成功信息提示框
function showSuccessTips(successMes, successTitle){
	toastr.success(successMes, successTitle)
	toastr.options = {
	  "closeButton":true,
	  "debug":false,
	  "positionClass":"toast-bottom-full-width",
	  "showDuration": "300",
	  "hideDuration": "1000",
	  "timeOut": "5000",
	  "extendedTimeOut": "1000",
	  "showEasing": "swing",
	  "hideEasing": "linear",
	  "showMethod": "fadeIn",
	  "hideMethod": "fadeOut"
	}
}

//警告信息提示
function showWarnTips(warnMes, warnTitle){
	toastr.warning(warnMes, warnTitle)
	toastr.options = {
	  "closeButton":true,
	  "debug":false,
	  "positionClass":"toast-bottom-full-width",
	  "showDuration": "300",
	  "hideDuration": "1000",
	  "timeOut": "5000",
	  "extendedTimeOut": "1000",
	  "showEasing": "swing",
	  "hideEasing": "linear",
	  "showMethod": "fadeIn",
	  "hideMethod": "fadeOut"
	}
}

//自动装载jquery form edit数据到 form表单中元素
function loadData(jsonStr){
	  var obj = eval("("+jsonStr+")");
	  var key,value,tagName,type,arr;
	  for(x in obj){
	    key = x;
	    value = obj[x];

	    $("[name='"+key+"'],[name='"+key+"[]']").each(function(){
	      tagName = $(this)[0].tagName;
	      type = $(this).attr('type');
	      if(tagName=='INPUT'){
	        if(type=='radio'){
	          $(this).attr('checked',$(this).val()==value);
	        }else if(type=='checkbox'){
	          arr = value.split(',');
	          for(var i =0;i<arr.length;i++){
	            if($(this).val()==arr[i]){
	              $(this).attr('checked',true);
	              break;
	            }
	          }
	        }else{
	          $(this).val(value);
	        }
	      }else if(tagName=='SELECT' || tagName=='TEXTAREA'){
	        $(this).val(value);
	      }

	    });
	  }
	}